﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using MobileGIS.Geometries;

namespace MobileGIS.Carto
{
    public class Feature:IFeature
    {
        private IClass m_class;
        private bool m_isDataUpdate;
        private bool m_isGeometryUpdate;
        private Geometry m_shape;
        private List<object> m_listValue;

        internal Feature(IFeatureClass Class)
        {
            this.Init(Class);

            for (int i = 0; i < Class.Fields.FieldCount; i++)
            {
                this.m_listValue.Add("");
            }
        }

        private void Init(IFeatureClass Class)
        {
            this.m_class = (IClass)Class;
            this.m_listValue = new List<object>();
        }

        
        
        
        #region IFeature Members

        public object GetValue(int index)
        {
            return this.m_listValue[index];
        }

        public void Save()
        {
            throw new NotImplementedException();
        }

        public void SetValue(int index, object value)
        {
            IFeatureClass class2 = this.m_class as IFeatureClass;
            if (class2.IsEdit())
            {
                this.m_listValue[index] = value;
                this.m_isDataUpdate = true;
            }
        }

        public IFeatureClass Class
        {
            get {
                return (IFeatureClass)this.m_class;
            }
        }

        public MobileGIS.Geometries.Geometry Shape
        {
            get
            {
                return this.m_shape;
            }
            set
            {
                this.m_shape = value;
                this.m_isGeometryUpdate = true;
            }
        }

        #endregion
    }
}
